import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { LeagueClassVO, LeagueClassForm, LeagueClassQuery } from '@/api/primary/leagueClass/types';

/**
 * 查询团课信息列表
 * @param query
 * @returns {*}
 */

export const listLeagueClass = (query?: LeagueClassQuery): AxiosPromise<LeagueClassVO[]> => {
  return request({
    url: '/primary/leagueClass/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询团课信息详细
 * @param id
 */
export const getLeagueClass = (id: string | number): AxiosPromise<LeagueClassVO> => {
  return request({
    url: '/primary/leagueClass/' + id,
    method: 'get'
  });
};

/**
 * 新增团课信息
 * @param data
 */
export const addLeagueClass = (data: LeagueClassForm) => {
  return request({
    url: '/primary/leagueClass',
    method: 'post',
    data: data
  });
};

/**
 * 修改团课信息
 * @param data
 */
export const updateLeagueClass = (data: LeagueClassForm) => {
  return request({
    url: '/primary/leagueClass',
    method: 'put',
    data: data
  });
};

/**
 * 删除团课信息
 * @param id
 */
export const delLeagueClass = (id: string | number | Array<string | number>) => {
  return request({
    url: '/primary/leagueClass/' + id,
    method: 'delete'
  });
};
